import numpy as np
import matplotlib.pyplot as plt

t = np.arange(0,375,6.5)

# CPU_1 = [0.044, 2.13, 2.547, 1.862, 0.044, 2.31, 2.021, 2.233, 0.044, 2.146, 2.16, 1.629, 0.041, 2.021, 2.424, 2.292, 0.042, 2.081, 2.172, 1.947, 0.04, 2.004, 2.221, 2.084, 0.043, 2.133, 2.219, 2.125, 0.041, 0.04, 0.042, 0.042, 0.044, 0.042]
# CPU_2 = [0.046, 1.745, 5.602, 3.034, 3.649, 2.019, 1.975, 0.431, 2.772, 3.138, 4.13, 0.277, 3.5, 2.581, 2.076, 2.029, 0.128, 3.266, 3.846, 4.197, 4.612, 1.929, 0.938, 1.326, 0.105, 1.755, 1.916, 1.806, 0.111, 0.108, 0.101, 0.102, 0.104, 0.106]
# CPU_3 = [0.042, 1.786, 5.027, 8.873, 9.895, 5.632, 4.811, 5.485, 3.964, 2.239, 2.226, 1.725, 5.081, 4.485, 5.497, 5.478, 8.201, 4.51, 3.104, 2.54, 0.176, 1.654, 2.022, 1.884, 0.189, 0.166, 0.2, 0.205, 0.204, 0.182, 0.161, 0.159, 0.192, 0.18]
# CPU_4 = [0.038, 2.128, 2.821, 5.838, 14.7, 13.999, 8.499, 3.762, 2.7, 5.535, 5.369, 3.896, 0.295, 6.142, 7.283, 4.526, 7.568, 2.212, 1.301, 2.171, 1.573, 0.256, 0.26, 0.238, 0.232, 0.224, 0.254, 0.248, 0.259, 0.227, 0.229, 0.230, 0.230, 0.230]
# CPU_5 = [0.041, 1.945, 4.505, 4.567, 11.23, 17.233, 13.638, 10.353, 5.235, 5.866, 7.402, 5.141, 1.494, 0.379, 3.606, 5.334, 4.471, 0.421, 0.45, 2.026, 1.106, 1.273, 0.289, 0.318, 0.288, 0.255, 0.292, 0.344, 0.327, 0.312, 0.287, 0.283, 0.283, 0.285]
# CPU_6 = [0.041, 2.139, 4.479, 5.162, 8.76, 10.771, 20.178, 13.755, 13.583, 4.954, 15.834, 13.597, 8.947, 4.87, 2.37, 2.302, 1.706, 2.444, 2.565, 0.345, 0.345, 0.324, 0.308, 0.366, 0.323, 0.296, 0.296, 0.307, 0.325, 0.305, 0.300, 0.300, 0.300, 0.300]
# CPU_7 = [0.041, 1.598, 5.734, 4.334, 9.935, 10.904, 10.082, 22.259, 17.52, 16.623, 5.388, 14.138, 12.635, 8.811, 3.124, 2.15, 1.909, 2.509, 1.014, 0.659, 0.562, 0.545, 0.475, 0.435, 0.415, 0.433, 0.420, 0.420, 0.420, 0.420, 0.420, 0.420, 0.420, 0.420]

#58
CPU_1 = [0.054, 1.782, 1.822, 1.133, 2.08, 3.71, 2.477, 1.129, 0.692, 1.681, 1.319, 2.08, 1.149, 0.424, 0.39, 0.051, 2.109, 2.23, 1.885, 4.542, 2.287, 2.28, 0.052, 2.132, 2.058, 1.875, 6.129, 1.998, 1.373, 0.132, 1.638, 1.726, 1.894, 1.9, 0.268, 1.145, 2.054, 0.062, 1.896, 1.291, 2.141, 3.756, 1.143, 0.96, 1.289, 0.055, 2.208, 1.88, 2.155, 5.006, 2.242, 2.105, 2.036, 0.054, 0.049, 0.068, 0.054, 0.055]
#38
CPU_2 = [0.052, 0.115, 5.209, 5.046, 3.937, 6.023, 3.343, 6.303, 4.332, 1.128, 2.438, 2.534, 2.869, 4.277, 6.594, 9.291, 3.611, 2.195, 1.514, 2.63, 2.958, 5.638, 2.813, 1.454, 1.841, 1.602, 1.629, 2.203, 2.131, 4.746, 2.352, 1.854, 0.987, 0.123, 0.131, 1.048, 0.109, 0.113, 0.109, 0.113, 0.1, 0.11, 0.1, 0.11, 0.1, 0.11, 0.1, 0.11, 0.1, 0.11, 0.1, 0.11, 0.1, 0.11, 0.1, 0.11, 0.1, 0.11]
#30
CPU_3 = [0.121, 0.19, 5.809, 6.031, 6.337, 7.108, 2.762, 3.035, 4.312, 0.754, 5.874, 3.517, 5.396, 9.297, 4.087, 7.626, 5.238, 2.265, 3.49, 2.14, 2.236, 1.09, 0.774, 0.551, 1.432, 0.188, 0.178, 0.17, 0.174, 0.179, 0.175, 0.176,  0.175, 0.176, 0.175, 0.176, 0.175, 0.176, 0.175, 0.176, 0.175, 0.176, 0.175, 0.176, 0.175, 0.176, 0.175, 0.176, 0.175, 0.176, 0.175, 0.176, 0.175, 0.176, 0.175, 0.176, 0.175, 0.175]
#23
CPU_4 = [0.144, 0.244, 7.89, 8.294, 8.634, 16.141, 5.586, 9.699, 5.727, 3.395, 3.388, 5.414, 5.248, 4.125, 3.491, 4.771, 3.511, 1.439, 0.231, 0.207, 0.231, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2, 0.204, 0.2]
#22
CPU_5 = [0.217, 0.301, 9.32, 8.516, 10.755, 9.648, 4.061, 9.044, 9.511, 4.438, 6.747, 3.918, 3.309, 5.672, 3.287, 4.541, 2.563, 0.315, 0.295, 0.273, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.288, 0.272, 0.280]
#22
CPU_6 = [0.277, 0.362, 11.855, 11.15, 13.059, 11.319, 3.362, 7.177, 11.961, 3.981, 3.483, 1.578, 2.521, 3.85, 2.598, 2.427, 2.659, 0.366, 0.363, 0.353, 0.341, 0.376, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362, 0.36, 0.362]
#16
CPU_7 = [0.425, 0.467, 13.158, 12.473, 10.997, 13.544, 16.962, 5.127, 6.349, 10.048, 1.635, 0.465, 0.497, 0.466, 0.471, 0.478, 0.497, 0.466, 0.471, 0.478, 0.497, 0.466, 0.471, 0.478, 0.497, 0.466, 0.471, 0.478, 0.497, 0.466, 0.471, 0.478, 0.497, 0.466, 0.471, 0.478, 0.497, 0.466, 0.471, 0.478, 0.497, 0.466, 0.471, 0.478, 0.497, 0.466, 0.471, 0.478, 0.497, 0.466, 0.471, 0.478, 0.497, 0.466, 0.471, 0.478, 0.475, 0.475]

font1 = {
'family' : 'Times New Roman',
'weight' : 'normal',
'size'   : 28,
}

font2 = {
'family' : 'Times New Roman',
'weight' : 'normal',
'size'   : 20,
}

plt.title('processing CPU% Analysis',font1)
l1, = plt.plot(t,CPU_1,color='green',marker="o",label='1 hadoop group')
l2, = plt.plot(t,CPU_2,color='darkorange',marker="o",label='2 hadoop group')
l3, = plt.plot(t,CPU_3,color='yellow',marker="o",label='3 hadoop group')
l4, = plt.plot(t,CPU_4,color='greenyellow',marker="o",label='4 hadoop group')
l5, = plt.plot(t,CPU_5,color='springgreen',marker="o",label='5 hadoop group')
l6, = plt.plot(t,CPU_6,color='darkslategrey',marker="o",label='6 hadoop group')
l7, = plt.plot(t,CPU_7,color='red',marker="o",label='7 hadoop group')
#l2, = plt.plot(x2,multi,color='red',label='multi hadoop group')
# color: darkorange lightcoral darkgoldenrod yellow greenyellow springgreen darkslategrey deepskyblue fushsia blue

x_ticks = np.arange(0,380,30)
y_ticks = np.arange(0,25,5)

plt.legend(handles=[l1,l2,l3,l4,l5,l6,l7],labels=['1-hadoop-group-CPU','2-hadoop-group-CPU','3-hadoop-group-CPU','4-hadoop-group-CPU','5-hadoop-group-CPU','6-hadoop-group-CPU','7-hadoop-group-CPU'],loc="best")
plt.xlabel('time unit(seconds)',font2)
plt.ylabel('hadoop occupy CPU unit(% 32Processor)',font2)

plt.xticks(x_ticks)
plt.yticks(y_ticks)

#plt.savefig('.CPU%.png')

plt.show()
